


/*   request请求封装  */
let constants = require('constants.js');
var sendRequest = function (url, method, data, header) {
    if( !header['content-type'] ){
        header['content-type'] = 'application/x-www-form-urlencoded';
    }
    var promise = new Promise(function (resolve, reject) {
        wx.request({
            url: constants.requestUrl+url+'.php',
            data: data,
            method: method,
            header: header,
            success: resolve,
            fail: reject
        })
    });
    return promise;
};
module.exports.sendRequest = sendRequest;